import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ShopVO, ShopQuery } from '@/api/retail/shop/types';
import {AccountVO} from "@/api/retail/account/types";
import {ProfitRatioVO} from "@/api/retail/profitRatio/types";

/**
 * 查询商铺信息列表
 * @param query
 * @returns {*}
 */

export const listShop = (query?: ShopQuery): AxiosPromise<ShopVO[]> => {
  return request({
    url: '/merchant/shop/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询商铺信息详细
 * @param id
 */
export const getShop = (id: number | string | undefined): AxiosPromise<ShopVO> => {
  return request({
    url: '/merchant/shop/' + id,
    method: 'get'
  });
};

export const getAccountList = (shopId: string | number): AxiosPromise<AccountVO[]> => {
  return request({
    url: '/merchant/shop/account/'+shopId,
    method: 'get'
  });
};
export const getProfitConfig = (shopId?: string | number): AxiosPromise<ProfitRatioVO[]> => {
  return request({
    url: '/merchant/shop/profitRatio/' + shopId,
    method: 'get'
  });
}
